﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Sheep.cs" company="melcoprog">
//   Copyright (c) melcoprog. All rights reserved.
// </copyright>
// <summary>
//   Defines the Sheep type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace CreatureSheep
{
    using System.Windows.Forms;

    using Creature;

    using CreatureSheep.CreatureStates.Hooked;

    /// <summary>
    /// The sheep.
    /// </summary>
    public class Sheep : Creature, IHook
    {
        /// <summary>
        /// The hooked state.
        /// </summary>
        private readonly ICreatureState hookedState;

        /// <summary>
        /// Initializes a new instance of the <see cref="Sheep"/> class.
        /// </summary>
        /// <param name="stateMachine">
        /// The state machine.
        /// </param>
        /// <param name="startState">
        /// The start State.
        /// </param>
        /// <param name="hookedState">
        /// The hooked State.
        /// </param>
        public Sheep(IStateMachine stateMachine, ICreatureState startState, ICreatureState hookedState)
            : base(stateMachine, startState)
        {
            this.hookedState = hookedState;
            this.X = Cursor.Position.X;
            this.Y = Cursor.Position.Y;
        }

        /// <summary>
        /// The hook.
        /// </summary>
        public void Hook()
        {
            this.SetState(this.hookedState);
        }

        /// <summary>
        /// The un hook.
        /// </summary>
        public void UnHook()
        {
            this.SetState();
        }
    }
}
